package com.atguigu.srb.core.controller.admin;


import com.atguigu.guigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.LendReturn;
import com.atguigu.srb.core.service.LendReturnService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 还款记录表 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2022-11-19
 */
@RestController
@RequestMapping("/admin/core/lendReturn")
public class AdminLendReturnController {
    @Resource
    LendReturnService lendReturnService;

    @ApiOperation("管理员查询指定标的所有还款计划")
    @GetMapping("/lend/{lendId}")
    public R list(@PathVariable("lendId")String lendId){
        List<LendReturn> lendReturns = lendReturnService.list(Wrappers.lambdaQuery(LendReturn.class)
                .eq(LendReturn::getLendId, lendId));
        return R.ok().data("items" ,lendReturns );
    }
}

